{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "from statsmodels.stats.multitest import multipletests\n",
    "from statsmodels.stats.proportion import proportions_ztest\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATH = r'\\\\10.40.12.80\\home\\PhD\\Results\\Competition\\DL\\small_arenas\\Ir84a\\silencing\\crossed_with_white_minus\\processed\\food'\n",
    "FPS = 60\n",
    "N_MINUTES = 5\n",
    "N_FRAMES = N_MINUTES * 60 * FPS # First five minutes of copulation.\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='paper',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.0,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [4.0, 4.0],\n",
    "            'figure.titlesize': 30.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.0,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figure4')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print(\"New folder created.\")\n",
    "except FileExistsError:\n",
    "    print(\"Folder already exists, skipping.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['gal4_control', 'uas_control', 'test']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " gal4_control\n",
      "Copulation too short: video_2021-02-10T10_24_13_arena2.csv\n",
      "\t\n",
      " test\n",
      "Copulation too short: video_2021-02-11T11_11_10_arena6.csv\n",
      "\t\n",
      " uas_control\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'gal4_control': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-05T11_39_22_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-05T11_39_22_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-05T12_16_51_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-08T10_00_51_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-08T10_00_51_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-08T12_06_28_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-08T12_06_28_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-08T12_38_30_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-09T10_34_50_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-09T10_34_50_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-09T11_16_40_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-09T11_16_40_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-09T12_02_10_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-09T12_42_06_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T10_24_13_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T10_24_13_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T11_04_44_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T11_04_44_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T11_04_44_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T11_43_39_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T11_43_39_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T11_43_39_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T12_20_42_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T12_20_42_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-10T12_20_42_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-11T10_24_57_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-11T10_24_57_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-11T10_24_57_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-11T10_24_57_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-11T11_11_10_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-11T11_58_28_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\gal4_control\\\\video_2021-02-11T11_58_28_arena7.csv'],\n",
       " 'uas_control': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-05T11_39_22_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-05T12_16_51_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-05T12_16_51_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-08T10_00_51_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-08T10_00_51_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-08T12_06_28_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-08T12_06_28_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-08T12_38_30_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-08T12_38_30_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-08T12_38_30_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-09T11_16_40_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-09T11_16_40_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-09T12_02_10_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-09T12_02_10_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-09T12_42_06_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-09T12_42_06_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-10T10_24_13_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-10T11_04_44_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-10T11_43_39_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-10T11_43_39_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-10T12_20_42_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-11T10_24_57_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-11T10_24_57_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-11T11_11_10_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-11T11_11_10_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-11T11_11_10_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-11T11_58_28_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-11T11_58_28_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\uas_control\\\\video_2021-02-11T11_58_28_arena8.csv'],\n",
       " 'test': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-05T11_39_22_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-05T11_39_22_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-05T11_39_22_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-05T11_39_22_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-05T12_16_51_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-08T10_00_51_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-08T10_00_51_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-08T10_00_51_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-08T10_00_51_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-08T12_06_28_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-08T12_06_28_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-08T12_38_30_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-08T12_38_30_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-08T12_38_30_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-09T10_34_50_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-09T11_16_40_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-09T11_16_40_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-09T12_02_10_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-09T12_02_10_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-09T12_02_10_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-09T12_42_06_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-09T12_42_06_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-09T12_42_06_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-10T10_24_13_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-10T10_24_13_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-10T11_04_44_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-10T11_43_39_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-10T12_20_42_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-11T10_24_57_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-11T11_11_10_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\Ir84a\\\\silencing\\\\crossed_with_white_minus\\\\processed\\\\food\\\\test\\\\video_2021-02-11T11_58_28_arena4.csv']}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    \n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "    \n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.name.endswith('.csv'):\n",
    "            \n",
    "            annotation_video = annotations.read(item.path)\n",
    "\n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "                \n",
    "                # Filter out videos where copulation is interrupted.\n",
    "                copulation_end = copulation.time_interval[1]\n",
    "                if copulation_end==N_FRAMES:\n",
    "                    if copulatio.duration < 5 * 60 * FPS:\n",
    "                        print('Copulation interrupted:', item.name)\n",
    "                        continue\n",
    "\n",
    "                # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                copulation_duration = copulation.duration\n",
    "                if copulation_duration <= 8 * 60 * FPS:\n",
    "                    print('Copulation too short:', item.name)\n",
    "                    continue\n",
    "            \n",
    "            except IndexError:\n",
    "                continue\n",
    "            \n",
    "            experiments[condition].append(item.path)\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Aggression Analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration: 0 \n",
      "Experiment: video_2021-02-05T11_39_22_arena2.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2021-02-05T11_39_22_arena6.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2021-02-05T12_16_51_arena10.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2021-02-08T10_00_51_arena12.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2021-02-08T10_00_51_arena15.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2021-02-08T12_06_28_arena2.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2021-02-08T12_06_28_arena8.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2021-02-08T12_38_30_arena16.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2021-02-09T10_34_50_arena14.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2021-02-09T10_34_50_arena4.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2021-02-09T11_16_40_arena14.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2021-02-09T11_16_40_arena2.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2021-02-09T12_02_10_arena13.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2021-02-09T12_42_06_arena6.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2021-02-10T10_24_13_arena4.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2021-02-10T10_24_13_arena8.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2021-02-10T11_04_44_arena11.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2021-02-10T11_04_44_arena12.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2021-02-10T11_04_44_arena14.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2021-02-10T11_43_39_arena3.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2021-02-10T11_43_39_arena4.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2021-02-10T11_43_39_arena7.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2021-02-10T12_20_42_arena10.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2021-02-10T12_20_42_arena5.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2021-02-10T12_20_42_arena6.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2021-02-11T10_24_57_arena11.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2021-02-11T10_24_57_arena13.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2021-02-11T10_24_57_arena14.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2021-02-11T10_24_57_arena15.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2021-02-11T11_11_10_arena9.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2021-02-11T11_58_28_arena1.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 31 \n",
      "Experiment: video_2021-02-11T11_58_28_arena7.csv \n",
      "Condition: gal4_control \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2021-02-05T11_39_22_arena4.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2021-02-05T12_16_51_arena15.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2021-02-05T12_16_51_arena9.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2021-02-08T10_00_51_arena3.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2021-02-08T10_00_51_arena4.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2021-02-08T12_06_28_arena4.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2021-02-08T12_06_28_arena6.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2021-02-08T12_38_30_arena12.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2021-02-08T12_38_30_arena3.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2021-02-08T12_38_30_arena7.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2021-02-09T11_16_40_arena1.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2021-02-09T11_16_40_arena9.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2021-02-09T12_02_10_arena15.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2021-02-09T12_02_10_arena9.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2021-02-09T12_42_06_arena12.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2021-02-09T12_42_06_arena15.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2021-02-10T10_24_13_arena5.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2021-02-10T11_04_44_arena13.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2021-02-10T11_43_39_arena11.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2021-02-10T11_43_39_arena12.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2021-02-10T12_20_42_arena1.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2021-02-11T10_24_57_arena10.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2021-02-11T10_24_57_arena12.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2021-02-11T11_11_10_arena10.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2021-02-11T11_11_10_arena13.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2021-02-11T11_11_10_arena14.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2021-02-11T11_58_28_arena3.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2021-02-11T11_58_28_arena6.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2021-02-11T11_58_28_arena8.csv \n",
      "Condition: uas_control \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2021-02-05T11_39_22_arena1.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2021-02-05T11_39_22_arena3.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2021-02-05T11_39_22_arena7.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2021-02-05T11_39_22_arena8.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2021-02-05T12_16_51_arena13.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2021-02-08T10_00_51_arena11.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2021-02-08T10_00_51_arena16.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2021-02-08T10_00_51_arena7.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2021-02-08T10_00_51_arena8.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2021-02-08T12_06_28_arena3.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2021-02-08T12_06_28_arena5.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2021-02-08T12_38_30_arena11.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2021-02-08T12_38_30_arena15.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2021-02-08T12_38_30_arena8.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2021-02-09T10_34_50_arena3.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2021-02-09T11_16_40_arena10.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2021-02-09T11_16_40_arena5.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2021-02-09T12_02_10_arena12.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2021-02-09T12_02_10_arena14.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2021-02-09T12_02_10_arena16.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2021-02-09T12_42_06_arena11.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2021-02-09T12_42_06_arena16.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2021-02-09T12_42_06_arena2.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2021-02-10T10_24_13_arena1.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2021-02-10T10_24_13_arena6.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2021-02-10T11_04_44_arena15.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2021-02-10T11_43_39_arena8.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2021-02-10T12_20_42_arena13.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2021-02-11T10_24_57_arena16.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2021-02-11T11_11_10_arena1.csv \n",
      "Condition: test \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2021-02-11T11_58_28_arena4.csv \n",
      "Condition: test \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>aggression_latency</th>\n",
       "      <th>aggression_latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>1130.0</td>\n",
       "      <td>0.313889</td>\n",
       "      <td>336</td>\n",
       "      <td>7</td>\n",
       "      <td>0.018667</td>\n",
       "      <td>1.4</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-05T11_39_22_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>3699.0</td>\n",
       "      <td>1.027500</td>\n",
       "      <td>19</td>\n",
       "      <td>3</td>\n",
       "      <td>0.001056</td>\n",
       "      <td>0.6</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-05T11_39_22_arena6.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>3386.0</td>\n",
       "      <td>0.940556</td>\n",
       "      <td>17</td>\n",
       "      <td>5</td>\n",
       "      <td>0.000944</td>\n",
       "      <td>1.0</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-05T12_16_51_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>2771.0</td>\n",
       "      <td>0.769722</td>\n",
       "      <td>242</td>\n",
       "      <td>4</td>\n",
       "      <td>0.013444</td>\n",
       "      <td>0.8</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-08T10_00_51_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-08T10_00_51_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>True</td>\n",
       "      <td>915.0</td>\n",
       "      <td>0.254167</td>\n",
       "      <td>77</td>\n",
       "      <td>30</td>\n",
       "      <td>0.004278</td>\n",
       "      <td>6.0</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-10T11_43_39_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>True</td>\n",
       "      <td>466.0</td>\n",
       "      <td>0.129444</td>\n",
       "      <td>23</td>\n",
       "      <td>4</td>\n",
       "      <td>0.001278</td>\n",
       "      <td>0.8</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-10T12_20_42_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>True</td>\n",
       "      <td>5506.0</td>\n",
       "      <td>1.529444</td>\n",
       "      <td>278</td>\n",
       "      <td>9</td>\n",
       "      <td>0.015444</td>\n",
       "      <td>1.8</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-11T10_24_57_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>True</td>\n",
       "      <td>467.0</td>\n",
       "      <td>0.129722</td>\n",
       "      <td>443</td>\n",
       "      <td>9</td>\n",
       "      <td>0.024611</td>\n",
       "      <td>1.8</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-11T11_11_10_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>True</td>\n",
       "      <td>235.0</td>\n",
       "      <td>0.065278</td>\n",
       "      <td>142</td>\n",
       "      <td>4</td>\n",
       "      <td>0.007889</td>\n",
       "      <td>0.8</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-11T11_58_28_arena4.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>92 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  aggression_latency  aggression_latency_mins  nframes  \\\n",
       "0             True              1130.0                 0.313889      336   \n",
       "1             True              3699.0                 1.027500       19   \n",
       "2             True              3386.0                 0.940556       17   \n",
       "3             True              2771.0                 0.769722      242   \n",
       "4            False                 NaN                 0.000000        0   \n",
       "..             ...                 ...                      ...      ...   \n",
       "87            True               915.0                 0.254167       77   \n",
       "88            True               466.0                 0.129444       23   \n",
       "89            True              5506.0                 1.529444      278   \n",
       "90            True               467.0                 0.129722      443   \n",
       "91            True               235.0                 0.065278      142   \n",
       "\n",
       "    nbouts  ratio_frames  ratio_bouts     condition  \\\n",
       "0        7      0.018667          1.4  gal4_control   \n",
       "1        3      0.001056          0.6  gal4_control   \n",
       "2        5      0.000944          1.0  gal4_control   \n",
       "3        4      0.013444          0.8  gal4_control   \n",
       "4        0      0.000000          0.0  gal4_control   \n",
       "..     ...           ...          ...           ...   \n",
       "87      30      0.004278          6.0          test   \n",
       "88       4      0.001278          0.8          test   \n",
       "89       9      0.015444          1.8          test   \n",
       "90       9      0.024611          1.8          test   \n",
       "91       4      0.007889          0.8          test   \n",
       "\n",
       "                               experiment  \n",
       "0    video_2021-02-05T11_39_22_arena2.csv  \n",
       "1    video_2021-02-05T11_39_22_arena6.csv  \n",
       "2   video_2021-02-05T12_16_51_arena10.csv  \n",
       "3   video_2021-02-08T10_00_51_arena12.csv  \n",
       "4   video_2021-02-08T10_00_51_arena15.csv  \n",
       "..                                    ...  \n",
       "87   video_2021-02-10T11_43_39_arena8.csv  \n",
       "88  video_2021-02-10T12_20_42_arena13.csv  \n",
       "89  video_2021-02-11T10_24_57_arena16.csv  \n",
       "90   video_2021-02-11T11_11_10_arena1.csv  \n",
       "91   video_2021-02-11T11_58_28_arena4.csv  \n",
       "\n",
       "[92 rows x 9 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aggression_df = pd.DataFrame()\n",
    "for condition in condition_order:\n",
    "    for h, experiment_path in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "        \n",
    "        print('Iteration:', h, '\\nExperiment:', experiment, '\\nCondition:', condition, '\\n')\n",
    "        \n",
    "        # Exclude experiments without copulation (since aggression is only observed during copulation).\n",
    "        annotation_video = annotations.read(experiment_path)\n",
    "        try:\n",
    "            copulation = annotation_video[0].events[0]\n",
    "        except IndexError:\n",
    "            continue\n",
    "        \n",
    "        aggression_events = list(filter(lambda event: event.time < (copulation.time + N_FRAMES), annotation_video[1].events)) # Consider aggression only during the first 5 minutes of copulation.\n",
    "        n_events = len(aggression_events)\n",
    "\n",
    "        # In case there is aggression, do the necessary calculations.\n",
    "        if n_events > 0:\n",
    "            aggression_latency =  aggression_events[0].time - copulation.time\n",
    "            aggression_latency_mins = aggression_latency / (60 * FPS)\n",
    "            ratio_frames = sum([aggression.duration for aggression in aggression_events]) / N_FRAMES\n",
    "            ratio_bouts = n_events / N_MINUTES\n",
    "\n",
    "            aggression_data = pd.DataFrame({'has_aggression': True,\n",
    "                                            'aggression_latency': aggression_latency,\n",
    "                                            'aggression_latency_mins': aggression_latency_mins,\n",
    "                                            'nframes': sum([aggression.duration for aggression in aggression_events]),\n",
    "                                            'nbouts': n_events,\n",
    "                                            'ratio_frames': ratio_frames,\n",
    "                                            'ratio_bouts': ratio_bouts,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # If not, preset our dictionary with default values.\n",
    "        else:\n",
    "            aggression_data = pd.DataFrame({'has_aggression': False,\n",
    "                                            'aggression_latency': np.nan,\n",
    "                                            'aggression_latency_mins': 0,\n",
    "                                            'nframes': 0,\n",
    "                                            'nbouts': 0,\n",
    "                                            'ratio_frames': 0, \n",
    "                                            'ratio_bouts': 0,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "        \n",
    "        # Concatenate all data together.\n",
    "        aggression_df = pd.concat([aggression_df, aggression_data], ignore_index=True)\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Outlier Detection"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t gal4_control \n",
      "\n",
      "[6]\n",
      "Number data points considered outliers: 1\n",
      "Percent data points considered outliers: 3.125 %\n",
      "\n",
      "\t uas_control \n",
      "\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "\n",
      "\t test \n",
      "\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>aggression_latency</th>\n",
       "      <th>aggression_latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>1130.0</td>\n",
       "      <td>0.313889</td>\n",
       "      <td>336</td>\n",
       "      <td>7</td>\n",
       "      <td>0.018667</td>\n",
       "      <td>1.4</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-05T11_39_22_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>3699.0</td>\n",
       "      <td>1.027500</td>\n",
       "      <td>19</td>\n",
       "      <td>3</td>\n",
       "      <td>0.001056</td>\n",
       "      <td>0.6</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-05T11_39_22_arena6.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>3386.0</td>\n",
       "      <td>0.940556</td>\n",
       "      <td>17</td>\n",
       "      <td>5</td>\n",
       "      <td>0.000944</td>\n",
       "      <td>1.0</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-05T12_16_51_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>2771.0</td>\n",
       "      <td>0.769722</td>\n",
       "      <td>242</td>\n",
       "      <td>4</td>\n",
       "      <td>0.013444</td>\n",
       "      <td>0.8</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-08T10_00_51_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>gal4_control</td>\n",
       "      <td>video_2021-02-08T10_00_51_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>True</td>\n",
       "      <td>915.0</td>\n",
       "      <td>0.254167</td>\n",
       "      <td>77</td>\n",
       "      <td>30</td>\n",
       "      <td>0.004278</td>\n",
       "      <td>6.0</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-10T11_43_39_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>True</td>\n",
       "      <td>466.0</td>\n",
       "      <td>0.129444</td>\n",
       "      <td>23</td>\n",
       "      <td>4</td>\n",
       "      <td>0.001278</td>\n",
       "      <td>0.8</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-10T12_20_42_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>True</td>\n",
       "      <td>5506.0</td>\n",
       "      <td>1.529444</td>\n",
       "      <td>278</td>\n",
       "      <td>9</td>\n",
       "      <td>0.015444</td>\n",
       "      <td>1.8</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-11T10_24_57_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>True</td>\n",
       "      <td>467.0</td>\n",
       "      <td>0.129722</td>\n",
       "      <td>443</td>\n",
       "      <td>9</td>\n",
       "      <td>0.024611</td>\n",
       "      <td>1.8</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-11T11_11_10_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>True</td>\n",
       "      <td>235.0</td>\n",
       "      <td>0.065278</td>\n",
       "      <td>142</td>\n",
       "      <td>4</td>\n",
       "      <td>0.007889</td>\n",
       "      <td>0.8</td>\n",
       "      <td>test</td>\n",
       "      <td>video_2021-02-11T11_58_28_arena4.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>91 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  aggression_latency  aggression_latency_mins  nframes  \\\n",
       "0             True              1130.0                 0.313889      336   \n",
       "1             True              3699.0                 1.027500       19   \n",
       "2             True              3386.0                 0.940556       17   \n",
       "3             True              2771.0                 0.769722      242   \n",
       "4            False                 NaN                 0.000000        0   \n",
       "..             ...                 ...                      ...      ...   \n",
       "87            True               915.0                 0.254167       77   \n",
       "88            True               466.0                 0.129444       23   \n",
       "89            True              5506.0                 1.529444      278   \n",
       "90            True               467.0                 0.129722      443   \n",
       "91            True               235.0                 0.065278      142   \n",
       "\n",
       "    nbouts  ratio_frames  ratio_bouts     condition  \\\n",
       "0        7      0.018667          1.4  gal4_control   \n",
       "1        3      0.001056          0.6  gal4_control   \n",
       "2        5      0.000944          1.0  gal4_control   \n",
       "3        4      0.013444          0.8  gal4_control   \n",
       "4        0      0.000000          0.0  gal4_control   \n",
       "..     ...           ...          ...           ...   \n",
       "87      30      0.004278          6.0          test   \n",
       "88       4      0.001278          0.8          test   \n",
       "89       9      0.015444          1.8          test   \n",
       "90       9      0.024611          1.8          test   \n",
       "91       4      0.007889          0.8          test   \n",
       "\n",
       "                               experiment  \n",
       "0    video_2021-02-05T11_39_22_arena2.csv  \n",
       "1    video_2021-02-05T11_39_22_arena6.csv  \n",
       "2   video_2021-02-05T12_16_51_arena10.csv  \n",
       "3   video_2021-02-08T10_00_51_arena12.csv  \n",
       "4   video_2021-02-08T10_00_51_arena15.csv  \n",
       "..                                    ...  \n",
       "87   video_2021-02-10T11_43_39_arena8.csv  \n",
       "88  video_2021-02-10T12_20_42_arena13.csv  \n",
       "89  video_2021-02-11T10_24_57_arena16.csv  \n",
       "90   video_2021-02-11T11_11_10_arena1.csv  \n",
       "91   video_2021-02-11T11_58_28_arena4.csv  \n",
       "\n",
       "[91 rows x 9 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "corrected_ratio_frames = pd.DataFrame()\n",
    "\n",
    "for condition in condition_order:\n",
    "\n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        dataset = aggression_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "        outlier_positions = helpers.check_outliers(dataset)\n",
    "        print(outlier_positions)\n",
    "\n",
    "        fresh_dataset = pd.DataFrame(helpers.remove_outliers(dataset, indices=outlier_positions))\n",
    "        fresh_dataset['condition'] = condition\n",
    "\n",
    "        corrected_ratio_frames = pd.concat([corrected_ratio_frames, fresh_dataset], axis=0)\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "\n",
    "aggression_df = aggression_df.loc[corrected_ratio_frames.index]\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aggression Rate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>ratio_frames</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>gal4_control</td>\n",
       "      <td>0.018667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>gal4_control</td>\n",
       "      <td>0.001056</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>gal4_control</td>\n",
       "      <td>0.000944</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>gal4_control</td>\n",
       "      <td>0.013444</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>gal4_control</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>test</td>\n",
       "      <td>0.004278</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>test</td>\n",
       "      <td>0.001278</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>test</td>\n",
       "      <td>0.015444</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>test</td>\n",
       "      <td>0.024611</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>test</td>\n",
       "      <td>0.007889</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>91 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       condition  ratio_frames\n",
       "0   gal4_control      0.018667\n",
       "1   gal4_control      0.001056\n",
       "2   gal4_control      0.000944\n",
       "3   gal4_control      0.013444\n",
       "4   gal4_control      0.000000\n",
       "..           ...           ...\n",
       "87          test      0.004278\n",
       "88          test      0.001278\n",
       "89          test      0.015444\n",
       "90          test      0.024611\n",
       "91          test      0.007889\n",
       "\n",
       "[91 rows x 2 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_df = aggression_df.copy()[['condition', 'ratio_frames']]\n",
    "ratio_frames_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t gal4_control \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.148963\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.07954465200939037 \n",
      "\n",
      "\n",
      "\t uas_control \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.721663\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.3502557203089426 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'gal4_control': 0.07954465200939037, 'uas_control': 0.3502557203089426}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_pvalues = {}\n",
    "\n",
    "test = ratio_frames_df.query('condition==\"test\"')['ratio_frames']\n",
    "\n",
    "for condition in condition_order[:-1]:\n",
    "        \n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        control = ratio_frames_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "        temp_values = {'control': control, 'test': test}\n",
    "\n",
    "        pvalue_condition = helpers.run_statistics(temp_values)\n",
    "\n",
    "        ratio_frames_pvalues[condition] = pvalue_condition\n",
    "    \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "    \n",
    "ratio_frames_pvalues"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Bonferroni Correction\n",
      "---------------------\n",
      "\n",
      "\tOriginal Values:\n",
      " {'gal4_control': 0.07954465200939037, 'uas_control': 0.3502557203089426}\n",
      "\n",
      "\tCorrected Values:\n",
      " {'gal4_control': 0.15908930401878074, 'uas_control': 0.7005114406178852} \n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Bonferroni corretction for multiple comparisons.\n",
    "title = 'Bonferroni Correction'\n",
    "print(title)\n",
    "print('-'*len(title))\n",
    "\n",
    "# Show uncorrected values.\n",
    "print('\\n\\tOriginal Values:\\n', ratio_frames_pvalues)\n",
    "\n",
    "# Apply the bonferroni correction for multiple comparisons.\n",
    "ratio_frames_multi_comp_correction = multipletests(pvals=list(ratio_frames_pvalues.values()), alpha=0.05, method='bonferroni')[1]\n",
    "\n",
    "# Transform the correction results into a dictionary.\n",
    "corrected_ratio_frames_pvalues = dict(zip(list(ratio_frames_pvalues.keys()), ratio_frames_multi_comp_correction))\n",
    "\n",
    "# Show corrected values.\n",
    "print('\\n\\tCorrected Values:\\n', corrected_ratio_frames_pvalues, '\\n')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "gal4_control\n",
      "Large Efect: 0.8593749999999999 \n",
      "\n",
      "uas_control\n",
      "Small Effect: -0.20666666666666667 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'gal4_control': 0.8593749999999999, 'uas_control': -0.20666666666666667}"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_sizes = {}\n",
    "\n",
    "test = ratio_frames_df.query('condition==\"test\"')['ratio_frames']\n",
    "\n",
    "for condition in condition_order[:-1]:\n",
    "\n",
    "    print(condition)\n",
    "    \n",
    "    control = ratio_frames_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "    \n",
    "    ratio_frames_sizes[condition] = median_diff\n",
    "    \n",
    "ratio_frames_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP4AAAEgCAYAAACU1c66AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nOzdd3QU1d/H8ffsbrLpPSEhDUhCb6GEEHovgiBdpEtvggpYQJqiCIiIWFFBQFCRXqWXUKVIb4EkpJFCets2zx/rL8gjhAWSzIbM65ycQ5bs7mdn57tzd+6dewVRFEVkMlmZopA6gEwmK3ly4ctkZZBc+DJZGSQXvkxWBsmFL5OVQXLhy2RlUIkW/qZNm7C3ty/Jp5TJZI8glFQ//s2bN+nUqRMJCQlkZWWVxFPKZLLHKJEjfk5ODgMGDOCzzz4riaeTyWRPUCKFP2rUKEaNGkXt2rVL4ulkMtkTFHvhf/XVV6hUKoYNG/bEv501axaCIBT8yGSy4lHs3/FDQkLIyclBpVKh0Wi4fv06t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M2awt7eXFy9e5HPPPccnn3ySarWaGRkZNJlM49YxevaaJFtbW6lUKnn+/HmPHPFJebWLWMAjCDIkTvUFQYZE4guCDInEFwQZEokvCDIkEl8QZEgkviDIkEh8QZAhkfiCIEMi8QVBhkTiC4IM/Q8p9ORl6o3E6wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 270x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = ratio_frames_df['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='condition',\n",
    "            y='ratio_frames',\n",
    "            data=ratio_frames_df,\n",
    "            order=condition_order,\n",
    "            width=0.6,\n",
    "            showfliers=False,\n",
    "            palette=['#f3c053', '#f3c053', '#ff5714'],\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK},\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='condition',\n",
    "              y='ratio_frames',\n",
    "              data=ratio_frames_df,\n",
    "              order=condition_order,\n",
    "              palette=['#f3c053', '#f3c053', '#ff5714'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('Aggression Rate (%)')\n",
    "axis.set_ylim(0, 0.04)\n",
    "axis.set_yticks(np.arange(0, 0.04+0.001, 0.01))\n",
    "axis.set_yticklabels([int(y*100) for y in axis.get_yticks()])\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(ratio_frames_df.query('condition==\"'+condition+'\"').shape[0]) for condition in condition_order]\n",
    "row2 = ['IR84a-GAL4;\\n+', '+;\\nUAS-Kir', 'IR84a-GAL4;\\nUAS-Kir']\n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='center',\n",
    "                           colLoc='center',\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical results.\n",
    "for p, condition in enumerate(condition_order[:-1]):\n",
    "    sig_height = 6 if (corrected_ratio_frames_pvalues.get(condition, 'NaN') == 'NaN') or (corrected_ratio_frames_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=1-p,\n",
    "                                 x2=1-p,\n",
    "                                 p_value=corrected_ratio_frames_pvalues.get(condition, 'NaN'),\n",
    "                                 y=0.036,\n",
    "                                 ticksize=0,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'aggression_rate_5mins_Ir84a'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
